<?php
	require_once '../Helpers/QueryHelper.php';
	require_once '../Models/Campaign.php';
	//
	class CampaignController
	{
		public function __construct()
		{
			//
		}
		public function createDetails($campaign)
		{
			$s = "INSERT INTO Campaigns SET Status = '$campaign-getStatus()', " . 
					"Name = $campaign->getName(), AgencyName = '$campaign->getAgencyName()', " . 
					"PublisherSite = '$campaign->getPublisherSite()', " . 
					"AdvertiserName = '$campaign->getAdvertiserName()', " . 
					"BrandName = '$campaign->geBrandName()', " . 
					"ServingPeriodStart = '$campaign->getServingPeriod()->getStart()', " . 
					"ServingPeriodEnd = '$campaign->getServingPeriod()->getEnd()', " . 
					"ServeIndicator = '$campaign->getServeIndicator()', " . 
					"Comment = '$campaign->getComment()'";
		}
		public function readDetails($campaign)
		{
			$s = "SELECT Status, Name, AgencyName, PublisherSite, AdvertiserName, BrandName, " . 
					"ServingPeriodStart, ServingPeriodEnd, ServeIndicator, Comment " . 
					"FROM Campaigns WHERE Id = $campaign->getId()";
		}
		public function updateDetails($campaign)
		{
		}
		public function deleteDetails($campaign)
		{
		}
		//
		public function getContainers($campaignId, $limit)
		{
			$s = "SELECT Containers.Id, Containers.Name"
				. "FROM Containers INNER JOIN ContainersPerCampaign"
				. "on Containers.Id = ContainersPerCampaign.ContainerId"
				. "INNER JOIN Campaigns"
				. "on ContainersPerCampaign.CampaignId = "
				. "(SELECT Id FROM Campaigns WHERE Campaigns.Id = $campaignId)"
				. "GROUP BY Containers.Name LIMIT 0, $limit ";
		}
	}
?>